package com.robot.member.dao;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import com.robot.member.pojo.Address;

/**
 * address数据访问接口
 *
 * @author wuyunbin
 */
public interface AddressDao extends JpaRepository<Address, String>, JpaSpecificationExecutor<Address> {
    /**
     * 通过memberId查询地址列表并分页
     *
     * @param memberId
     * @param pageable
     * @return
     */
    public Page<Address> findAllByMemberIdAndDeletedAtIsNullOrderByCreatedAtDesc(String memberId, Pageable pageable);

    /**
     * 通过id和memberId查询地址
     *
     * @param id
     * @param memberId
     * @return
     */
    public Address findByIdAndMemberId(String id, String memberId);
}
